Exercise 10.3

One solution involves the use of an additional table, containing just the allowable values.  This can be referenced using a foreign key constraint.  The required syntax is, for example,

IF OBJECT_ID('yesno') IS NOT NULL DROP TABLE yesno 
CREATE TABLE yesno (
 possiblevalue CHAR(1) PRIMARY KEY NOT NULL 
) 
INSERT INTO yesno VALUES('Y') 
INSERT INTO yesno VALUES('N') 

ALTER TABLE claim
ADD CONSTRAINT claimApprovedBoolean
 FOREIGN KEY (approved)
 REFERENCES yesno(possiblevalue)
    

To view the code for the updated ResetDB procedure, use the Database Explorer, and expand the Stored Procedures node of the Database.mdf file.  You can then view the procedure, or execute it, by right clicking the mouse over the stored procedure's name.